﻿<Window
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:ff="clr-namespace:View"
	x:Class="View.Window1"
	x:Name="Window"
	Title="Kikoo Instant Messenger"
	Width="365" Height="650" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    mc:Ignorable="d" WindowStyle="ThreeDBorderWindow" WindowStartupLocation="Manual" Loaded="Window_Loaded" Closing="Window_Closing">
	<Window.Resources>
        
        <Style x:Key="listBoxStyle">
            <Style.Resources>
                <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Blue" />
                <SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="Blue" />
            </Style.Resources>
        </Style>
    
        <Storyboard x:Key="OnUserConnected">
			<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="gridContacts" Storyboard.TargetProperty="(UIElement.Opacity)">
				<SplineDoubleKeyFrame KeyTime="00:00:01" Value="0"/>
				<SplineDoubleKeyFrame KeyTime="00:00:02" Value="1"/>
			</DoubleAnimationUsingKeyFrames>
			<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="gridLogin" Storyboard.TargetProperty="(UIElement.Opacity)">
				<SplineDoubleKeyFrame KeyTime="00:00:01" Value="0" KeySpline="0,1,0,1"/>
			</DoubleAnimationUsingKeyFrames>
			<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="gridLogin" Storyboard.TargetProperty="(UIElement.Visibility)">
				<DiscreteObjectKeyFrame KeyTime="00:00:01" Value="{x:Static Visibility.Collapsed}"/>
			</ObjectAnimationUsingKeyFrames>
			<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="gridContacts" Storyboard.TargetProperty="(UIElement.Visibility)">
				<DiscreteObjectKeyFrame KeyTime="00:00:01" Value="{x:Static Visibility.Visible}"/>
				<DiscreteObjectKeyFrame KeyTime="00:00:02" Value="{x:Static Visibility.Visible}"/>
			</ObjectAnimationUsingKeyFrames>
			<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="button" Storyboard.TargetProperty="(UIElement.Opacity)">
				<SplineDoubleKeyFrame KeyTime="00:00:01" Value="0"/>
				<SplineDoubleKeyFrame KeyTime="00:00:01.5000000" Value="0"/>
				<SplineDoubleKeyFrame KeyTime="00:00:02" Value="1"/>
			</DoubleAnimationUsingKeyFrames>
			<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="button" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)">
				<SplineDoubleKeyFrame KeyTime="00:00:01" Value="-1"/>
				<SplineDoubleKeyFrame KeyTime="00:00:01.5000000" Value="1"/>
			</DoubleAnimationUsingKeyFrames>
			<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="button" Storyboard.TargetProperty="(FrameworkElement.HorizontalAlignment)">
				<DiscreteObjectKeyFrame KeyTime="00:00:01" Value="{x:Static HorizontalAlignment.Center}"/>
				<DiscreteObjectKeyFrame KeyTime="00:00:01.5000000" Value="{x:Static HorizontalAlignment.Left}"/>
			</ObjectAnimationUsingKeyFrames>
			<ThicknessAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="button" Storyboard.TargetProperty="(FrameworkElement.Margin)">
				<SplineThicknessKeyFrame KeyTime="00:00:01" Value="0,64,0,0"/>
				<SplineThicknessKeyFrame KeyTime="00:00:01.5000000" Value="15,40,0,0"/>
			</ThicknessAnimationUsingKeyFrames>
			<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="imageAvatar" Storyboard.TargetProperty="(UIElement.Opacity)">
				<SplineDoubleKeyFrame KeyTime="00:00:02" Value="1"/>
			</DoubleAnimationUsingKeyFrames>
			<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="imageAvatar" Storyboard.TargetProperty="(UIElement.Visibility)">
				<DiscreteObjectKeyFrame KeyTime="00:00:02" Value="{x:Static Visibility.Visible}"/>
			</ObjectAnimationUsingKeyFrames>
		</Storyboard>
		<Storyboard x:Key="OnClickDeconnect">
			<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="gridContacts" Storyboard.TargetProperty="(UIElement.Opacity)">
				<SplineDoubleKeyFrame KeySpline="0,1,0,1" KeyTime="00:00:01" Value="0"/>
			</DoubleAnimationUsingKeyFrames>
			<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="gridContacts" Storyboard.TargetProperty="(UIElement.Visibility)">
				<DiscreteObjectKeyFrame KeyTime="00:00:01" Value="{x:Static Visibility.Collapsed}"/>
			</ObjectAnimationUsingKeyFrames>
			<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="button" Storyboard.TargetProperty="(UIElement.Opacity)">
				<SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
				<SplineDoubleKeyFrame KeyTime="00:00:01" Value="0"/>
				<SplineDoubleKeyFrame KeyTime="00:00:01.5000000" Value="1" KeySpline="0,1,0.441,0.749"/>
			</DoubleAnimationUsingKeyFrames>
			<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="gridLogin" Storyboard.TargetProperty="(UIElement.Visibility)">
				<DiscreteObjectKeyFrame KeyTime="00:00:01.5000000" Value="{x:Static Visibility.Visible}"/>
			</ObjectAnimationUsingKeyFrames>
			<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="gridLogin" Storyboard.TargetProperty="(UIElement.Opacity)">
				<SplineDoubleKeyFrame KeyTime="00:00:01.5000000" Value="1"/>
			</DoubleAnimationUsingKeyFrames>
			<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="button" Storyboard.TargetProperty="(FrameworkElement.HorizontalAlignment)">
				<DiscreteObjectKeyFrame KeyTime="00:00:00" Value="{x:Static HorizontalAlignment.Center}"/>
				<DiscreteObjectKeyFrame KeyTime="00:00:01" Value="{x:Static HorizontalAlignment.Center}"/>
				<DiscreteObjectKeyFrame KeyTime="00:00:01.5000000" Value="{x:Static HorizontalAlignment.Center}"/>
			</ObjectAnimationUsingKeyFrames>
			<ThicknessAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="button" Storyboard.TargetProperty="(FrameworkElement.Margin)">
				<SplineThicknessKeyFrame KeyTime="00:00:00" Value="0,90,0,0"/>
				<SplineThicknessKeyFrame KeyTime="00:00:01" Value="0,90,0,0"/>
				<SplineThicknessKeyFrame KeyTime="00:00:01.5000000" Value="0,90,0,0"/>
			</ThicknessAnimationUsingKeyFrames>
		</Storyboard>
		<ControlTemplate x:Key="ButtonControlTemplate1" TargetType="{x:Type Button}">
			<ControlTemplate.Resources>
				<Storyboard x:Key="OnMouseEnter1">
					<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)">
						<SplineDoubleKeyFrame KeyTime="00:00:00.2000000" Value="1.15"/>
					</DoubleAnimationUsingKeyFrames>
					<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)">
						<SplineDoubleKeyFrame KeyTime="00:00:00.2000000" Value="1.15"/>
					</DoubleAnimationUsingKeyFrames>
				</Storyboard>
				<Storyboard x:Key="OnMouseLeave1">
					<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)">
						<SplineDoubleKeyFrame KeyTime="00:00:00.2000000" Value="1"/>
					</DoubleAnimationUsingKeyFrames>
					<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)">
						<SplineDoubleKeyFrame KeyTime="00:00:00.2000000" Value="1"/>
					</DoubleAnimationUsingKeyFrames>
				</Storyboard>
				<Storyboard x:Key="OnClick1">
					<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)">
						<SplineDoubleKeyFrame KeyTime="00:00:00.2000000" Value="-1"/>
						<SplineDoubleKeyFrame KeyTime="00:00:00.4000000" Value="1"/>
					</DoubleAnimationUsingKeyFrames>
				</Storyboard>
			</ControlTemplate.Resources>
			<Grid>
				<Image Margin="0,0,0,0" Source="Icones\add-user-48x48.png" x:Name="image" RenderTransformOrigin="0.5,0.5" Panel.ZIndex="0">
					<Image.RenderTransform>
						<TransformGroup>
							<ScaleTransform ScaleX="1" ScaleY="1"/>
							<SkewTransform AngleX="0" AngleY="0"/>
							<RotateTransform Angle="0"/>
							<TranslateTransform X="0" Y="0"/>
						</TransformGroup>
					</Image.RenderTransform>
				</Image>
				<Button Margin="0,0,0,0" Content="Button" Opacity="0" x:Name="button" Visibility="Visible" Panel.ZIndex="1"/>
			</Grid>
			<ControlTemplate.Triggers>
				<EventTrigger RoutedEvent="ButtonBase.Click" SourceName="button">
					<BeginStoryboard Storyboard="{StaticResource OnClick1}" x:Name="OnClick1_BeginStoryboard"/>
				</EventTrigger>
				<EventTrigger RoutedEvent="Mouse.MouseLeave" SourceName="button">
					<BeginStoryboard x:Name="OnMouseLeave1_BeginStoryboard" Storyboard="{StaticResource OnMouseLeave1}"/>
				</EventTrigger>
				<EventTrigger RoutedEvent="Mouse.MouseEnter" SourceName="button">
					<BeginStoryboard Storyboard="{StaticResource OnMouseEnter1}"/>
				</EventTrigger>
			</ControlTemplate.Triggers>
		</ControlTemplate>
		<ControlTemplate x:Key="ButtonControlTemplate2" TargetType="{x:Type Button}">
			<ControlTemplate.Resources>
				<Storyboard x:Key="OnMouseEnter1">
					<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)">
						<SplineDoubleKeyFrame KeyTime="00:00:00.2000000" Value="1.15"/>
					</DoubleAnimationUsingKeyFrames>
					<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)">
						<SplineDoubleKeyFrame KeyTime="00:00:00.2000000" Value="1.15"/>
					</DoubleAnimationUsingKeyFrames>
				</Storyboard>
				<Storyboard x:Key="OnMouseLeave1">
					<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)">
						<SplineDoubleKeyFrame KeyTime="00:00:00.2000000" Value="1"/>
					</DoubleAnimationUsingKeyFrames>
					<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)">
						<SplineDoubleKeyFrame KeyTime="00:00:00.2000000" Value="1"/>
					</DoubleAnimationUsingKeyFrames>
				</Storyboard>
				<Storyboard x:Key="OnClick1">
					<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)">
						<SplineDoubleKeyFrame KeyTime="00:00:00.2000000" Value="-1"/>
						<SplineDoubleKeyFrame KeyTime="00:00:00.4000000" Value="1"/>
					</DoubleAnimationUsingKeyFrames>
				</Storyboard>
			</ControlTemplate.Resources>
			<Grid>
				<Button Margin="0,0,0,0" Content="Button" Opacity="0" Panel.ZIndex="1" x:Name="button" RenderTransformOrigin="0.5,0.5">
					<Button.RenderTransform>
						<TransformGroup>
							<ScaleTransform ScaleX="1" ScaleY="1"/>
							<SkewTransform AngleX="0" AngleY="0"/>
							<RotateTransform Angle="0"/>
							<TranslateTransform X="0" Y="0"/>
						</TransformGroup>
					</Button.RenderTransform>
				</Button>
				<Image Margin="0,0,0,0" Source="Icones\remove-user-48x48.png" RenderTransformOrigin="0.5,0.5" x:Name="image">
					<Image.RenderTransform>
						<TransformGroup>
							<ScaleTransform ScaleX="1" ScaleY="1"/>
							<SkewTransform AngleX="0" AngleY="0"/>
							<RotateTransform Angle="0"/>
							<TranslateTransform X="0" Y="0"/>
						</TransformGroup>
					</Image.RenderTransform>
				</Image>
			</Grid>
			<ControlTemplate.Triggers>
				<EventTrigger RoutedEvent="ButtonBase.Click" SourceName="button">
					<BeginStoryboard Storyboard="{StaticResource OnClick1}" x:Name="OnClick1_BeginStoryboard"/>
				</EventTrigger>
				<EventTrigger RoutedEvent="Mouse.MouseEnter" SourceName="button">
					<BeginStoryboard Storyboard="{StaticResource OnMouseEnter1}"/>
				</EventTrigger>
				<EventTrigger RoutedEvent="Mouse.MouseLeave" SourceName="button">
					<BeginStoryboard x:Name="OnMouseLeave1_BeginStoryboard" Storyboard="{StaticResource OnMouseLeave1}"/>
				</EventTrigger>
			</ControlTemplate.Triggers>
		</ControlTemplate>
	</Window.Resources>
	<Window.Triggers>
		<EventTrigger RoutedEvent="MenuItem.Click" SourceName="menuItemDeconnect">
			<BeginStoryboard Storyboard="{StaticResource OnClickDeconnect}" x:Name="OnClickDeconnect_BeginStoryboard"/>
		</EventTrigger>
	</Window.Triggers>

	<Grid x:Name="LayoutRoot" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Visibility="Visible" Background="{DynamicResource Brush1}">
        <Menu Height="25" Margin="0,0,0,0" Name="menuKIM" VerticalAlignment="Top" HorizontalAlignment="Stretch" Foreground="#FFFFFFFF" BorderBrush="#FF576BA6" BorderThickness="1">
        	<Menu.Background>
        		<LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
        			<GradientStop Color="#FF122B8F" Offset="0.987"/>
        			<GradientStop Color="#FF4462A8" Offset="0"/>
        		</LinearGradientBrush>
        	</Menu.Background>
            <MenuItem Header="File" Foreground="#FFFFFFFF">
                <MenuItem Header="Exit" Name="menuItemQuit" Click="mnuExit_Click" Foreground="#FF000000"/>
            </MenuItem>
            <MenuItem Header="Option">
                <MenuItem Header="Change my avatar" x:Name="MenuItemChangeAvatar" Click="MenuItemChangeAvatar_Click" Foreground="#FF000000"/>
            </MenuItem>
            <MenuItem Header="Sign off" x:Name="menuItemDeconnexion">
                <MenuItem Header="Sign off" Foreground="#FF000000" x:Name="menuItemDeconnect" Click="menuItemDeconnect_Click"/>
            </MenuItem>
        </Menu>
		<Grid HorizontalAlignment="Stretch" x:Name="gridLogin" VerticalAlignment="Stretch" Width="Auto" Height="Auto" Margin="0,25,0,0" Visibility="Visible" Background="{x:Null}">
			<TextBlock HorizontalAlignment="Center" Margin="0,190,0,0" Foreground="#FFFFFFFF" TextWrapping="Wrap" d:LayoutOverrides="Height" VerticalAlignment="Top" Text="Entrez vos identifiants de connexion :"/>
			<Grid Margin="0,230,0,0" VerticalAlignment="Top" Height="250" d:LayoutOverrides="Width" HorizontalAlignment="Center" x:Name="gridConnect">
				<TextBlock TextWrapping="Wrap" Foreground="#FFFFFFFF" Text="Identifiant :" VerticalAlignment="Top" Height="15"/>

                <TextBox Margin="0,25,3.554,0" x:Name="textboxLogin" VerticalAlignment="Top" Height="25" TextWrapping="Wrap">
                    <TextBox.Text>
                        <Binding Path="Login" Mode="OneWayToSource" ValidatesOnExceptions="True" />
                    </TextBox.Text>
                </TextBox>
                <TextBlock TextWrapping="Wrap" Foreground="#FFFFFFFF" Text="Mot de passe :" Margin="0,55,0,0" VerticalAlignment="Top" Height="15"/>

                <PasswordBox x:Name="textboxPassword" Margin="0,80,3.554,0" VerticalAlignment="Top" Height="25" ff:PasswordBoxAssistant.BindPassword="true"
                             ff:PasswordBoxAssistant.BoundPassword="{Binding Path=Password, Mode=OneWayToSource, UpdateSourceTrigger=PropertyChanged, ValidatesOnExceptions=True}">
                </PasswordBox>
                <CheckBox Margin="0,115,0,0" x:Name="checkBoxNewAccount" VerticalAlignment="Top" Height="20" Content="Créez un nouveau compte" Foreground="#FFFFFFFF">
                    <CheckBox.IsChecked>
                        <Binding Path="CreateAccount" Mode="OneWayToSource"/>
                    </CheckBox.IsChecked>
                </CheckBox>
				<Button Command="{Binding Path=LoginCommand}" Margin="0,0,0,50" VerticalAlignment="Bottom" Height="25" Content="Connexion" Width="120" HorizontalAlignment="Center" x:Name="buttonConnect" />
			</Grid>
			<TextBlock Margin="0,8,0,0" VerticalAlignment="Top" Height="Auto" TextWrapping="Wrap" Text="Kikoo Instant Messenger" HorizontalAlignment="Center" Foreground="#FF77B5FF" FontSize="22" FontFamily="Kristen ITC"/>
			
		</Grid>
		<Grid HorizontalAlignment="Stretch" x:Name="gridContacts" VerticalAlignment="Stretch" Width="Auto" Height="Auto" Margin="0,25,0,0" Visibility="Collapsed" Background="{DynamicResource Brush1}">
            <ListView ItemsSource="{Binding ContactList}" Margin="15,175,15,15" IsSynchronizedWithCurrentItem="True" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" x:Name="listBoxContacts" SelectionMode="Single" MouseDoubleClick="listBoxContacts_MouseDoubleClick" Style="{StaticResource listBoxStyle}">
                <ListView.ItemContainerStyle>
                    <Style TargetType="{x:Type ListViewItem}"  >
                        <Style.Triggers>
                            <DataTrigger Binding="{Binding Path=Status}" Value="Disconnected">
                                <Setter Property="Foreground" Value="Black"/>
                            </DataTrigger>
                            <DataTrigger Binding="{Binding Path=Status}" Value="Away">
                                <Setter Property="Foreground" Value="Red"/>
                            </DataTrigger>
                            <DataTrigger Binding="{Binding Path=Status}" Value="Busy">
                                <Setter Property="Foreground" Value="Orange"/>
                            </DataTrigger>
                            <DataTrigger Binding="{Binding Path=Status}" Value="Connected">
                                <Setter Property="Foreground" Value="Blue"/>
                            </DataTrigger>
                        </Style.Triggers>
                    </Style>
                 </ListView.ItemContainerStyle>
                 <ListView.View>
                    <GridView>
                        <GridViewColumn Width="60" Header="Avatar">
                            <GridViewColumn.CellTemplate>
                                <DataTemplate>
                                    <Image Source="{Binding Path=Avatar}"/>
                                </DataTemplate>
                            </GridViewColumn.CellTemplate>
                        </GridViewColumn>
                        <GridViewColumn Width="245" Header="Contact">
                            <GridViewColumn.CellTemplate>
                                <DataTemplate>
                                    <TextBlock Text="{Binding Path=Alias}"/>
                                </DataTemplate>
                            </GridViewColumn.CellTemplate>
                        </GridViewColumn>
                    </GridView>
                </ListView.View>
                <ListView.ContextMenu>
                    <ContextMenu >
                        <Menu Name="CMenu">
                            <MenuItem Header="Edit" Click="mnuEditContact_Click"/>
                            <MenuItem Header="Delete" Click="mnuDeleteContact_Click"/>
                            <MenuItem Header="Add" Click="mnuAddContact_Click"/>
                        </Menu>
                    </ContextMenu>
                </ListView.ContextMenu>
            </ListView>

			<TextBlock HorizontalAlignment="Left" Margin="15,155,0,0" VerticalAlignment="Top" Width="Auto" Height="16" Text="Liste de vos contact :" TextWrapping="Wrap" Foreground="#FFFFFFFF"/>
            <Button HorizontalAlignment="Right" VerticalAlignment="Top" Width="25" Height="25" Content="-" Margin="0,145,15,0" x:Name="buttonDeleteContact" ToolTip="Remove a contact" Template="{DynamicResource ButtonControlTemplate2}" Click="buttonDeleteContact_Click" />
			<Button HorizontalAlignment="Right" x:Name="buttonAddContact" VerticalAlignment="Top" Width="25" Height="25" Content="+" Margin="0,145,45,0" ToolTip="Add a contact" Template="{DynamicResource ButtonControlTemplate1}" Click="buttonAddContact_Click"/>
			<ff:UserControlTextBoxPseudo Margin="115,4,0,0" VerticalAlignment="Top" Height="43" Width="Auto" HorizontalAlignment="Left" MinWidth="120" MaxWidth="240" Visibility="Visible" x:Name="userControlTextBoxPseudoInGridContacts"/>
		</Grid>
        <Button VerticalAlignment="Top" Width="100" Height="100" IsEnabled="False" HorizontalAlignment="Center" Margin="0,90,0,0" Visibility="Visible" RenderTransformOrigin="0.5,0.5" x:Name="button">
        	<Button.Background>
        		<LinearGradientBrush EndPoint="0,1" StartPoint="0,0" SpreadMethod="Pad">
        			<GradientStop Color="#FFF3F3F3" Offset="0"/>
        			<GradientStop Color="#FFEBEBEB" Offset="0.5"/>
        			<GradientStop Color="#FFDDDDDD" Offset="0.5"/>
        			<GradientStop Color="#FFCDCDCD" Offset="1"/>
        		</LinearGradientBrush>
        	</Button.Background>
			<Button.RenderTransform>
				<TransformGroup>
					<ScaleTransform ScaleX="1" ScaleY="1"/>
					<SkewTransform AngleX="0" AngleY="0"/>
					<RotateTransform Angle="0"/>
					<TranslateTransform X="0" Y="0"/>
				</TransformGroup>
			</Button.RenderTransform>
            <Image x:Name="imageAvatar" Height="100" Stretch="UniformToFill" Width="100"/>
           



            <!--<Image x:Name="imageAvatar" Width="Auto" Height="Auto" Source="{TemplateBinding Img}" Stretch="UniformToFill"/>-->
		</Button>
        
    </Grid>
</Window>